﻿using AlarmClock.BLL;
using System.Drawing;
using System.Windows.Forms;

namespace AlarmClock.UI
{
    public partial class FrmWeather : Form
    {
        public FrmWeather()
        {
            InitializeComponent();
            string imagePath = Application.StartupPath + @"\Resourse\Picture\天气.png";
            this.Icon = Icon.FromHandle(((Bitmap)Bitmap.FromFile(imagePath)).GetHicon());
        }

        public string cityName {  get; set; }

        public FrmWeather(string cityName) : this()
        {
            this.cb_Cities.Items.Clear();
            this.cb_Cities.Items.AddRange(BaiduWeatherWebApi.GetAllCities());
            this.cb_Cities.SelectedIndex = this.cb_Cities.FindString(cityName);

            this.btnOK.Click += (s1, e1) => { this.cityName = this.cb_Cities.Text; this.Close(); };
            this.btnCancel.Click += (s1, e1) => { this.cityName = cityName; this.Close(); };
        }

    }
}
